$("#getMsgNum").click(function(){
    var memPhone=$("#memPhone").val();
    console.log(memPhone.length);
    if (memPhone==''||memPhone.length!=11)
    {
        timer();
        window.alert("请输入正确的手机号！");
        return;
    }else {
        $.ajax({
            type: 'POST',
            url: '/phoneLogin',
            data: {
                memPhone : memPhone
            },
            dataType: 'json',
            success: function(data) {
                if(data){
                    timer();
                }else{
                    window.alert("获取验证码失败");
                }
            },
            error: function(data) {
                timer();
                alert('连接超时！');
            },
        });
    }
})
var wait = 60;
//倒计时
function timer() {
    if (wait == 0) {
        $("#getMsgNum").val("获取验证码");
        $("#getMsgNum").removeClass('orange');
        $("#getMsgNum").attr('class','ui positive button msg');
        $("#getMsgNum").removeAttr("disabled");
        wait = 60;
    } else {
        $("#getMsgNum").removeClass('positive');
        $("#getMsgNum").attr("disabled", "true").attr('class',' ui orange button msg');
        $("#getMsgNum").val(wait + "秒后重发");
        wait--;
        setTimeout(function () {
            timer()
        }, 1000);
    }
}